/*
 * 楼盘基本信息详情
 * @author 狮子
 * @time 2018/9/19
 * @since 1.0.0
 * */
// React基础组件
import React from 'react'
// dva 连接组件 - 连接route和model
import { connect } from 'dva'
//导入路由组件，用于跳转等
import { hashHistory } from 'dva/router'
// 导入项目全局配置文件
import config from 'config/config'
// 引入model取值工具方法
import { mapStateToProps } from 'utils/view_utils'
// 当前组件样式
import styles from './baseinfoDetailStyle.less'
//引用listPage
import cx from 'classnames'
import { Form, Row, Col, Input, Cascader, Icon, DatePicker, Select, Button, Upload, Modal, Divider, InputNumber,Tag,Tooltip,message} from 'antd'
const FormItem = Form.Item;
const { TextArea } = Input;
import { CollapsiblePanels } from 'widget/CollapsiblePanels/index'
import Uploader from 'widget/Upload'
import PopUpSelect from 'widget/PopUpOne/PopUpSelect'
import Track from 'widget/Map/Track'
import moment from "moment";
import FlagBtn from 'widget/FlagBtn/FlagView'
import { isEmpty, cloneDeep, } from 'lodash'
import { messageInform } from 'utils/notification';
//剪切板
// import CopyToClipboard from 'react-copy-to-clipboard';
const formItemLayout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 15 },
};
const formItemLastLayout = {
  labelCol: { span: 9 },
  wrapperCol: { span: 14 },
};
const formItemshortLayout = {
  labelCol: { span: 10 },
  wrapperCol: { span: 12 },
};
const lastLayout = {
  labelCol: { span: 4 },
  wrapperCol: { span: 15 },
};
const mideaLayout = {
  labelCol: { span: 4 },
  wrapperCol: { span: 18 },
}
const regionLayout = {
  labelCol: { span: 2 },
  wrapperCol: { span: 22 },
};
const videoUrlLayout = {
  labelCol: { span: 4 },
  wrapperCol: { span: 19 },
};
const imageLayout = {
  labelCol: { span: 2 },
  wrapperCol: { span: 22 },
}
const lightLayout = {
  labelCol: { span: 6 },
  wrapperCol: { span: 17 },
};
const littlelightLayout = {
  labelCol: { span: 6 },
  wrapperCol: { span: 17 },
};
const littlelightLayout7 = {
  labelCol: { span: 7 },
  wrapperCol: { span: 16 },
};


const sellerSelectedColumn = [
  { title: '工程编号', width: 120, dataIndex: 'projectCode', key: 'projectCode' },
  { title: '工程名称', width: 120, dataIndex: 'name', key: 'name' },
];
const sellerTableColumn = [
  { title: '工程编号', width: 120, dataIndex: 'projectCode', key: 'projectCode' },
  { title: '工程名称', width: 120, dataIndex: 'name', key: 'name' },
  { title: '地址', width: 120, dataIndex: 'address', key: 'address' },

];


const baseinfoDetailView = function ({ dispatch, model, form }) {
  const { resetFields, getFieldDecorator, validateFields, setFieldsValue } = form
  const { modelObj, namespace } = model
  let { name, previewVisible, previewImage, Mapmodel, showModel, tagALL, actionType, areaList,disabled,tagModel,
    sellerList, estateInfo={},saleMapmodel,min,min2,subElements } = modelObj
  // console.log(min,min2)
  //地图
  const mapQueryList = [
    { name: '省市', type: 'cascader', list: areaList, key: 'code', value: '' },
    { name: '分销商名称', type: 'text', key: 'sellerName', value: '' }
  ];
  //日期改变
  function onChange(date, dateString, type) {
    //console.log(date, dateString);
    estateInfo[type] = dateString
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { estateInfo }
    });
  }
  //添加
  function add(name) {
    let newarr
    let arr = estateInfo[name] || []

    form.resetFields()
    if (name == 'video') {
      newarr = arr.concat('');
    }
    estateInfo[name] = newarr
    //console.log(arr, estateInfo[name])
    dispatch({ type: `${namespace}/updateModel`, payload: { estateInfo } })
  }
  //删除
  function remove(k, name, index) {
    if (name == 'video') {
      let newarrCopy= estateInfo.videoImageFiles
      newarrCopy.splice(index, 1)
      estateInfo.videoImageFiles = newarrCopy
    }
    let newarr = estateInfo[name]
    newarr.splice(index, 1)
    //表单重置important
    form.resetFields()
    estateInfo[name] = newarr
    dispatch({ type: `${namespace}/updateModel`, payload: { estateInfo } })
  }
  //图片预览
  function handleCancel() {
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { previewVisible: false }
    });
  }
  function updateTagModel(e){
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { tagModel: e }
    })
  }
  function delTag(e,idx){
    e.preventDefault()//tag的bug
    estateInfo.estateRegion = estateInfo.estateRegion.filter((item,index) => index !== idx);
    console.log(estateInfo.estateRegion)
    dispatch({
      type:`${namespace}/updateModel`,
      payload: { estateInfo}
    })
     form.resetFields()
  }

  const getTaglist =  estateInfo.estateRegion&&estateInfo.estateRegion.map((item,idx)=>{
    //console.log(item)
    return <Tag closable={true} onClose={(e)=>delTag(e,idx)} key={idx}>{item}</Tag>
  })

  
  //视频input框动态
  // const formvideoItems = estateInfo.video && estateInfo.video.map((k, index) => {
  //   return (
  //     <Col span={12} key={`videoarr${index}`} >
  //         {/* <Col span={23} className={styles.margin}>
  //           <FormItem
  //             key={'video' + index}
  //             label="视频图片"
  //             {...videoUrlLayout}
  //           >
  
  //             <Uploader uploadedUrls ={estateInfo.videoImageFiles&&estateInfo.videoImageFiles[index]}
  //                     removeFileCbf={(index)=>{removeImgUrl(index,"videoImage")}}
  //                     uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"videoImage",index)} }
  //                     showType='3'
  //                     fileType='image'
  //                     maxFiles='1' />
  //           </FormItem>
  //         </Col> */}
  //         <Col span={23}>
  //           <FormItem
  //             required={false}
  //             key={'video' + index}
  //             label="视频url"
  //             {...videoUrlLayout}
  //           >
  //             {getFieldDecorator(`video[${index}]`, {
  //               validateTrigger: ['onChange', 'onBlur'],
  //               initialValue: k,
  //               rules: [{
  //                 required: false,
  //                 whitespace: true,
  //                 message: "请删除或者选择",
  //               }],
  //             })(
  //               <Input disabled={actionType == 'check'} placeholder="请输入" style={{ width: '100%', marginRight: '8px' }} onChange={(e) => inputChange(e.target.value, "video", index)} />
  //             )}

  //           </FormItem>
  //         </Col>
  //         <Col span={1}>
  //             <Icon
  //               className="dynamic-delete-button"
  //               type="minus-circle-o"
  //               style={{ fontSize: '16px', color: "#ccc", height: "40px" }}
  //               onClick={() => remove(k, 'video', index)}
  //             />
  //         </Col>
    
      
  //     </Col>
  //   )
  // });
  //更新弹出框status
  function updateModal(status) {
    if(status){
      ( modelObj.sellerQueryList||[]).map((item,index)=>{
        if(item.key!='appId'){
          item.value=''
        }
      })
    }
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { showModel: status }
    });
  }
  function updateMapmodel(status) {
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { Mapmodel: status }
    });
  }
  function updateSaleMapmodel(status) {
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { saleMapmodel: status }
    });
  }
  //提交
  function submit(status = 1) {
    
    if (status == 2) {
      hashHistory.push({ pathname: '/home/activity/activityList' })
      return false
    }
    form.validateFields((err, values) => {
      if(!err){
        dispatch({
          type: `${namespace}/sumbit`,
        })
      }
    });
  }
  //弹出框回调
  function cbk( latAndLon,mapAddress) {
    estateInfo.mapAddress = mapAddress
    estateInfo.latAndLon = latAndLon
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { estateInfo }
    });
    form.resetFields(['mapAddress'])
  }
  //弹出框回调
  function saleCbk( latAndLon,mapAddress) {
    estateInfo.saleMapAddress = mapAddress
    estateInfo.saleLatAndLon = latAndLon
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { estateInfo }
    });
    form.resetFields(['saleMapAddress'])
  }
  //所有类型改变时（除date image）
  function inputChange(val, type, index = null) {
    
    if (type == 'video') {
      estateInfo.video[index] = val
    } else if(type == 'avePrice'){
        //todo
      //  console.log(val,'----------------')
       estateInfo.avePrice = val
    }else if(type == 'visitMinHours'){
      // console.log(val)
      min = (val*60).toFixed(1)
      estateInfo[type] = val
      
    }else if(type == 'longestTime'){
      min2 = (val*60).toFixed(1)
      estateInfo[type] = val      
    }
    else if(type == 'estateRegion'){
      console.log(val)
      let arr = val.replace(/[\n\r|\n](?:[\n\r|\n])/mg,'').split(/[\r\n|\n]/)
      // arr=arr.slice(0,6)
      estateInfo.estateRegion= arr
      form.resetFields()
    }else {
      estateInfo[type] = val
    }
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { estateInfo,min,min2 }
    });
  }
  // 浮点型数字验证
  function getFolatNumber(rule, values, callback) {
    if (values && values.length > 0) {
      var re = /^\d+(?:\.\d{0,2})?$/;
      if (values.match(re) == null) {
        callback("请输入保留两位小数的数值");
      } else {
        callback();
      }
    } else {
      callback();
    }
  }
  
  //今天
  function disabledDate(current) {
    // Can not select days before today and today
    return current && current < moment().startOf('day');
  }
  function updateImageModel(value,item,idx){
    console.log(value,item,idx)
    if(item=='videoImage'){
      let two = [value]
      estateInfo.videoImageFiles.push(two)
    }else{
      console.log(estateInfo[item])
      if(estateInfo[item]){
        estateInfo[item].push(value)
      }else{
        estateInfo[item] = []
        estateInfo[item].push(value)
      }
    }
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { estateInfo }
    });
  };
  
  function updateImageModel2(value, fileObj){
    let videoObj = {
      url: value,
      name: value,
    }
    if(estateInfo.video){
      estateInfo.video.push(videoObj)
    }else{
      estateInfo.video = []
      estateInfo.video.push(videoObj)
    }
    // 分发到model
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {estateInfo}
    })
  }
  function updateVoiceUrl(value, fileObj){
    let voiceObj = {
      url: value,
      name: value,
    }
    if(estateInfo.voice){
      estateInfo.voice.push(voiceObj)
    }else{
      estateInfo.voice = []
      estateInfo.voice.push(voiceObj)
    }
    // 分发到model
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {estateInfo}
    })
  }
  function removeImgUrl(index,item) {
    estateInfo[item].splice(index,1)
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { estateInfo }
    });
   }

  function isSpecialChar(rule, str, callback){
    if (str && str.length > 0) {
      var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]")
      if(pattern.test(str)){
          callback("不能有特殊字符");
      }
      else {
        callback();
      }
    } else {
      callback();
    }
  }
 
  
  //修改状态
  const changeState = (payload) => {
    dispatch({
      type: `${namespace}/updateStore`,
      payload: { ...payload }
    })
  }
  
  // 选择项目弹窗确认
  function confirmCbk(v,params){
     // console.log('confirmCbk',v,params)
    if(v.length>0){
      let {appId}=params||{}
      let item=v[0]
      // estateInfo.projectName = v[0].name
       estateInfo.appId =appId
      // console.log(v)
      // debugger
      //1为旧系统 2为新系统
      dispatch({type:`${namespace}/updateStore`, payload:{sellerList:v,estateInfo}})
      // dispatch({ type: `${namespace}/queryItem`, payload: { projectCode:v[0].projectCode,projectId:v[0].projectId } })
      dispatch({ type: `${namespace}/queryItem`, payload: { ...item ,appId} })
      changeState({estateInfo})
    }
    // updateModal(false)
  }
  function normalizeAll(val){
    console.log('0000000',val)
  }
  // console.log(estateInfo)


   //复制小程序链接
  //  function copyUrl(e){
  //   e.preventDefault();
  // }
  //  function onCopy(url){
  //   //  console.log(url)
  //    if(url.length){
  //     message.success('复制成功')
  //    }else{
  //     message.err('复制失败')
  //    }
  //  }
//vrUrl失焦
function inputOnBlur(e){
  console.log(e)
}
  return (
    <div className={cx('public_listMain')}>
      <div className="functionButton">
        {/* <Button type='primary'>预览</Button> */}
        {actionType == "add" || actionType == "edit" ?
        <Button type='primary' onClick={e => submit(1)} disabled={disabled} loading={modelObj.btnLoading}>发布</Button> : null}
      </div>
      {/* <Row type="flex" justify="space-between" className={cx('pageTitle')} >
        <Col>
          {arrTitle[actionType]}
        </Col>
        <Col>
          <Button type='primary'>预览</Button>
          {actionType == "add" || actionType == "edit" ?
            <Button type='primary' onClick={e => submit(1)}>提交</Button> : null}
        </Col>
      </Row> */}

      <Modal visible={previewVisible} footer={null} onCancel={handleCancel}>
        <img alt="" style={{ width: '100%' }} src={previewImage} />
      </Modal>

      <CollapsiblePanels  clipboard={{isShow:estateInfo.shelfStatus===1&&actionType==='check',url:`/pages/biz/buildingDetail/buildingDetail?productId=${estateInfo.productId}`,title:'复制小程序跳转链接',tips:'此链接可用于项目在朋友圈投放广告时使用，将朋友圈广告（视频、原生推广页等）与此链接绑定后，用户点击后可直接去美的置业云的美房详情。（注：此链接是小程序专属链接，非传统的http链接，无法在浏览器打开）\n' +
''}} title={`楼盘基本信息：${estateInfo.name}`} hideUpDownBtn={true} style={{position:'relative'}}>

        <div className={styles.serverDetail + ' detailRowMain'}>
          <Row>
            {/* <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                required={true}
                label="工程名称">
                {getFieldDecorator('projectName', {
                
                })(<Row style={{ border: '0' }}><Col span={6}>{actionType !== 'check'&&<a onClick={(e) => { updateModal(true) }}>选择</a>}</Col><Col span={18}><span>{estateInfo.projectName}</span></Col></Row>)}
              </FormItem>
            </Col> */}
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="项目名称">
                {getFieldDecorator('name', {
                  initialValue: estateInfo.name,
                  rules: [
                    { required: true, whitespace: true, message: '请输入项目名称' },
                    {
                      validator: isSpecialChar//todo
                    }
                  ],
                })(<Input
                  placeholder={'示例 壹号公馆'}
                  disabled={actionType == 'check'}
                  maxLength={10}
                  onChange={(e) => { inputChange(e.target.value, 'name') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="项目编码">
                {getFieldDecorator('estateCode', {
                  initialValue: estateInfo.estateCode,
                  rules: [
                    { required: false, whitespace: true,message: '请输入正确的项目编码' },
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'项目编码暂不需要填写'}
                  disabled={actionType == 'check' || true}
                  onChange={(e) => { inputChange(e.target.value, 'estateCode') }}
                />)}
                </FormItem>
              
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="所属城市">
                {getFieldDecorator('bindCity', {
                  initialValue: estateInfo.bindCity,
                  rules: [
                    {
                      type: 'array',
                      required: true,
                      message: '请选择所属城市',
                    }
                  ],
                })(<Cascader disabled={actionType == 'check'} options={areaList} onChange={(date) => inputChange(date, 'bindCity')} placeholder="请选择" />)}
              </FormItem>
            </Col>
        
          </Row>
          <Row>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="规划面积">
                {getFieldDecorator('floorArea', {
                  initialValue: estateInfo.floorArea ? estateInfo.floorArea+"": "",
                  rules: [
                    { required: false, whitespace: true, message: '请输入规划面积' },
                    ],
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入规划面积'}
                  disabled={actionType == 'check'}
                  addonAfter="㎡"
                  onChange={(e) => { inputChange(e.target.value, 'floorArea') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="在售面积段">
                {getFieldDecorator('saleArea', {
                  initialValue: estateInfo.saleArea ? estateInfo.saleArea+'' :estateInfo.saleArea,
                  rules: [
                    { required: false, whitespace: true, message: '请输入在售面积段' },
                    { pattern:/\d/,message: '请输入数字，允许区间字符-'}
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入在售面积段'}
                  disabled={actionType == 'check'}
                  addonAfter="㎡"
                  onChange={(e) => { inputChange(e.target.value, 'saleArea') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="产权年限">
                {getFieldDecorator('propertyRight', {
                  initialValue: estateInfo.propertyRight,
                  rules: [
                    { required: false, whitespace: true, message: '请输入产权年限' },
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'针对住宅产品为主'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'propertyRight') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="规划户数">
                {getFieldDecorator('households', {
                  initialValue: estateInfo.households?estateInfo.households +"" :estateInfo.households,
                  rules: [
                    { required: false, whitespace: true, message: '请输入规划户数' },
                  ],
                  getValueFromEvent: (event) => {
                    return event.target.value.trim('')
                  },
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入规划户数'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value.trim(''), 'households') }}
                />)}
              </FormItem>
            </Col>

          </Row>
          <Row>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="装修标准">
                {getFieldDecorator('renovation', {
                  initialValue: estateInfo.renovation,
                  rules: [
                    { required: true, whitespace: true, message: '请选择装修标准' },
                  ],
                })(<Select placeholder="请选择" onChange={(val) => inputChange(val, 'renovation')} disabled={actionType == 'check'}>
                  <Select.Option value="带装修">带装修</Select.Option>
                  <Select.Option value="毛坯">毛坯</Select.Option>
                </Select>)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="车位配比">
                {getFieldDecorator('parking', {
                  initialValue: estateInfo.parking,
                  rules: [
                    { required:false, whitespace: true,  message: '请输入正确车位配比' },
                  ],
                  // getValueFromEvent: (event) => {
                  //   return event.target.value.replace(/\D/g,'')
                  // },
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入车位配比'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'parking') }}
                />)}
              </FormItem>
            </Col>
            
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="参考均价">
                {getFieldDecorator('avePrice', {
                  initialValue: estateInfo.avePrice ? estateInfo.avePrice+'':"",
                  rules: [
                    { required:false, whitespace: true, message: '请输入参考均价' },
                    { pattern:/^[0-9]\d*$/,message: '不能输入特殊符号，只能填数字。填写示例:8000'}
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'主力产品均价'}
                  addonAfter="元/㎡"
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'avePrice') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="楼盘电话">
                {getFieldDecorator('estatePhone', {
                  initialValue: estateInfo.estatePhone,
                  rules: [
                    { required: true, whitespace: true, message: '请输入楼盘电话' },
                    {
                      validator: (rule, values, callback) => {
                        if (values && values.length > 0) {
                          var isPhone = /^1[3456789]\d{9}$/;//手机号码
                          var isMob = /^(1[3456789]\d{9})|(((400)-(\d{3})-(\d{4}))|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{3,7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)$/ ;// 座机格式
                         
                          console.log(isMob.test(values))
                          console.log(isPhone.test(values))
                          if (isMob.test(values) || isPhone.test(values)) {
                            callback();
                          }
                          else {
                            callback("请输入正确的手机号格式");
                          }
                        } else {
                          callback();
                        }
                      }
                    }],
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入楼盘电话'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'estatePhone') }}
                />)}
              </FormItem>
            </Col>
            </Row>
            <Row>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="绿化率">
                {getFieldDecorator('green', {
                  initialValue: estateInfo.green ? estateInfo.green+'':estateInfo.green,
                  rules: [
                    { required: true, whitespace: true, message: '请输入绿化率' },
                    {
                      validator: getFolatNumber//todo
                    }
                  ],
                  normalize: (e) => {
                    if (!isNaN(e)) {
                      // console.log(e);
                      let reg = /([0-9]+\.[0-9]{2})[0-9]*/;
                      if (reg.test(e)) {
                        let reg = /([0-9]+\.[0-9]{2})[0-9]*/;
                        let aNew = e.replace(reg, "$1");
                        return aNew;
                      } else {
                        return e;
                      }
                    }
                  }
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入绿化率'}
                  addonAfter="%"
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'green') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="容积率">
                {getFieldDecorator('volume', {
                  initialValue: estateInfo.volume?estateInfo.volume+'':'',
                  rules: [
                    { required: true, whitespace: true, message: '请输入容积率' },
                    {
                      validator: getFolatNumber//todo
                    }
                  ],
                  normalize: (e) => {
                    if (!isNaN(e)) {
                      // console.log(e);
                      let reg = /([0-9]+\.[0-9]{2})[0-9]*/;
                      if (reg.test(e)) {
                        let reg = /([0-9]+\.[0-9]{2})[0-9]*/;
                        let aNew = e.replace(reg, "$1");
                        return aNew;
                      } else {
                        return e;
                      }
                    }
                  }
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入容积率'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'volume') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="近期开盘">
                {getFieldDecorator('openingTime', {
                  initialValue: estateInfo.openingTime ? moment(estateInfo.openingTime) : null,
                  rules: [
                    { type: 'object', required: false, whitespace: true, message: '近期开盘' },
                  ],
                })(<DatePicker  disabled={actionType == 'check'} onChange={(d, ds) => onChange(d, ds, 'openingTime')} placeholder={actionType == 'check'?'':"准备开盘或上一次开盘"} />)}
              </FormItem>
            </Col>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="交房时间">
                {getFieldDecorator('submitTime', {
                  initialValue: estateInfo.submitTime ? moment(estateInfo.submitTime) : null,
                  rules: [
                    { type: 'object', required: true, whitespace: true, message: '请选择交房时间' },
                  ],
                })(<DatePicker  onChange={(d, ds) => onChange(d, ds, 'submitTime')} placeholder={"在售产品交楼时间"} disabled={actionType == 'check'} />)}
              </FormItem>
            </Col>
          </Row>

          <Row>
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="开发商">
                {getFieldDecorator('developers', {
                  initialValue: estateInfo.developers,
                  rules: [
                    { required: true, whitespace: true, message: '请输入开发商' },
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入开发商'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'developers') }}
                />)}
              </FormItem>
            </Col>
            
            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="物业费">
                {getFieldDecorator('propertyCost', {
                  initialValue: estateInfo.propertyCost ? estateInfo.propertyCost+'':"",
                  rules: [
                    { required: true, whitespace: true, message: '请输入物业费' },
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'每平方每月的费用或其它'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'propertyCost') }}
                />)}
              </FormItem>
            </Col>


            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="物业公司">
                {getFieldDecorator('propertyCompany', {
                  initialValue: estateInfo.propertyCompany,
                  rules: [
                    { required: true, whitespace: true, message: '请输入物业公司' },
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入物业公司'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'propertyCompany') }}
                />)}
              </FormItem>
            </Col>

            <Col className="col" span={6}>
              <FormItem {...formItemLayout}
                label="备案名">
                {getFieldDecorator('recordName', {
                  initialValue: estateInfo.recordName,
                  rules: [
                    { required: true, whitespace: true, message: '请输入备案名' },
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入备案名'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'recordName') }}
                />)}
              </FormItem>
            </Col>
          </Row>
          <Row>
          <Col span={6}>
              <FormItem {...formItemLayout}
                label="销售状态">
                {getFieldDecorator('saleStatus', {
                  initialValue: estateInfo.saleStatus?estateInfo.saleStatus+'' : '',
                  rules: [
                    { required: true, whitespace: true, message: '请选择销售状态' },
                  ],
                })((<Select placeholder="请选择" onChange={(val) => inputChange(val, 'saleStatus')} disabled={actionType == 'check'}>
                  <Select.Option value="1">待售</Select.Option>
                  <Select.Option value="2">在售</Select.Option>
                  <Select.Option value="3">尾盘</Select.Option>
                  <Select.Option value="4">售罄</Select.Option>
                </Select>))}
              </FormItem>
            </Col>
            <Col span={6}>
              <FormItem {...formItemLayout}
                label="营销操盘">
                {getFieldDecorator('masterType', {
                  initialValue: estateInfo.masterType?estateInfo.masterType+'' : '',
                  rules: [
                    { required: true, whitespace: true, message: '请选择销售状态' },
                  ],
                })((<Select placeholder="请选择" onChange={(val) => inputChange(val, 'masterType')} disabled={actionType == 'check'}>
                  <Select.Option value="MEDIA">我方操盘</Select.Option>
                  <Select.Option value="PART">合作方操盘</Select.Option>
                </Select>))}
              </FormItem>
            </Col>
            <Col span={6}>
              <FormItem {...formItemLayout}
                label="是否移交物业">
                {getFieldDecorator('masterType1', {
                  initialValue: estateInfo.isTransferProperty?estateInfo.isTransferProperty+'' : '0',
                  rules: [
                    { required: true, whitespace: true, message: '请选择' },
                  ],
                })((<Select placeholder="请选择"  onChange={(val) => inputChange(val, 'isTransferProperty')} disabled={actionType == 'check'}>
                  <Select.Option value="0">否</Select.Option>
                  <Select.Option value="1">是</Select.Option>
                </Select>))}
              </FormItem>
            </Col>
          </Row>
          {/* <Row>
            <Col span={12}>
              <FormItem {...videoUrlLayout}
                label="展厅地址">
                {getFieldDecorator('saleAddress', {
                  initialValue: estateInfo.saleAddress,
                  rules: [
                    { required: false, whitespace: true, message: '请选择展厅地址' },
                  ],
                })(<Input
                  placeholder={actionType == 'check'?'':'请输入展厅地址'}
                  disabled={actionType == 'check'}
                  onChange={(e) => { inputChange(e.target.value, 'saleAddress') }}
                />)}
              </FormItem>
            </Col>
            
          </Row> */}
          {/* <Row>
            <Col className="col" span={24}>
              <FormItem {...imageLayout}
                label="展厅位置">
                {getFieldDecorator('saleMapAddress', {
                  rules: [
                    {
                      required: false,
                      validator: (rule, value, callback) => {
                        console.log(estateInfo.mapAddress)
                        if (estateInfo.mapAddress&&estateInfo.mapAddress.length === 0) {
                          callback('请添加展厅位置')
                        } else {
                          callback()
                        }
                      }
                    },
                  ],
                })(<Row style={{ border: 0 }}>
                  {actionType !== 'check'&& <Col span={2}><a onClick={(e) => { updateSaleMapmodel(true) }}>选择</a></Col>}
                  <Col span={12}><span>{estateInfo.saleMapAddress}</span></Col>
                  {estateInfo.saleLatAndLon && estateInfo.saleLatAndLon.length > 0 ? <Col>
                    <Col span={4}><span>经度:{estateInfo.saleLatAndLon[0]}</span>
                    </Col><Col span={4}>纬度:{estateInfo.saleLatAndLon[1]}</Col>
                  </Col> : null}
                </Row>)}

              </FormItem>
            </Col>

          </Row>*/}
          <Row> 
            <Col span={12}>
              <FormItem {...lastLayout}
                label="楼盘标签">
                {getFieldDecorator('tag', {
                  initialValue: estateInfo.tag,
                  rules: [
                    { required: false, type: 'array', whitespace: true, message: '请输入楼盘标签' },
                  ],
                })(<Select
                  mode="multiple"
                  size='default'
                  notFoundContent='没有此标签'
                  placeholder={actionType == 'check'?'':'请输入楼盘标签'}
                  disabled={actionType == 'check'}
                  onChange={(e, v) => {
                    let arr = []
                    v.map((item, idx) => {
                      arr.push(item.props.children)
                    })
                    console.log(arr)
                    inputChange(arr, 'tag')
                  }}
                  style={{ width: '100%' }}
                >
                  {tagALL&&tagALL.map((item, idx) => {
                    return (
                      <Select.Option key={item.tagId} value={item.name}>{item.name}</Select.Option>
                    )
                  })}
                </Select>)}
              </FormItem>
            </Col>
          </Row>
          <Row>

            <Col className="col" span={12}>
              <FormItem {...videoUrlLayout}
                label="楼盘地址">
                {getFieldDecorator('estateAddress', {
                  initialValue: estateInfo.estateAddress,
                  rules: [
                    { required: true, whitespace: true, message: '请输入楼盘地址' },
                  ],
                })(<Input
                  disabled={actionType == 'check'}
                  placeholder={actionType == 'check'?'':'请输入楼盘地址'}
                  onChange={(e) => { inputChange(e.target.value, 'estateAddress') }}
                />)}
              </FormItem>
            </Col>
          </Row>
          <Row>
            <Col className="col" span={24}>
              <FormItem {...imageLayout}
                label="楼盘位置">
                {getFieldDecorator('mapAddress', {
                  rules: [
                    {
                      required: true,
                      validator: (rule, value, callback) => {
                        if (!estateInfo.mapAddress||estateInfo.mapAddress=="") {
                          callback('请添加楼盘位置')
                        } else {
                          callback()
                        }
                      }
                    },
                  ],
                })(<Row style={{ border: 0 }}>
                 {actionType !== 'check'&& <Col span={2}><a onClick={(e) => { updateMapmodel(true) }}>选择</a></Col>}
                  <Col span={12}><span>{estateInfo.mapAddress}</span></Col>
                  {estateInfo.latAndLon && estateInfo.latAndLon.length > 0 ? <Col>
                    <Col span={4}><span>经度:{estateInfo.latAndLon[0]}</span>
                    </Col><Col span={4}>纬度:{estateInfo.latAndLon[1]}</Col>
                  </Col> : null}
                </Row>)}

              </FormItem>
            </Col>

          </Row>
          {/* <Row>
            <Col className="col" span={12}>
              <FormItem {...videoUrlLayout}
                label="720°看房URL">
                {getFieldDecorator('house720', {
                  initialValue: estateInfo.house720,
                  rules: [
                    { required: false, whitespace: true, message: '请输入720°看房URL' },
                    { pattern:/mideazy.com/,  message:'请使用提交给集团转换后的VR地址！'}
                  ],
                })(<Input
                  disabled={actionType == 'check'}
                  placeholder={actionType == 'check'?'':'请输入720°看房URL'}
                  onChange={(e) => { inputChange(e.target.value, 'house720') }}
                />)}
              </FormItem>
            </Col>
            <Col span={10}><span style={{color:"#ccc"}}> <span style={{color:"red"}}> *</span>  请先将720°/VR看房地址邮件发送给集团IT-谭嘉杰(tanjj9@midea.com)，经集团备案转换后再将新地址录入</span></Col>
          </Row> */}
          <Row>
            <Col className="col" span={12}>
              <FormItem {...videoUrlLayout}
                        label="VR看房URL">
                {getFieldDecorator('vr', {
                  initialValue: estateInfo.vr,
                  rules: [
                    { required: false, whitespace: true, message: '请输入VR看房URL' },
                    {
                      validator:function(rule, value){
                        if(value && value != undefined && value != ""){
                          if(value.indexOf("mideazy.com") != -1 || value.indexOf("https://webcase.51hitech.com") != -1 || value.indexOf("https://osres.wangxiaobao.com") != -1 || value.indexOf("https://mr.ke.com") != -1|| value.indexOf("https://meidi.ideamake.cn") != -1|| value.indexOf("https://external-46.fang.anjuke.com") != -1 || value.indexOf("https://img360wcs.fang.com") != -1|| value.indexOf("https://car.vipmyvip.com/") != -1){
                            return Promise.resolve(); 
                          }
                          return Promise.reject('请使用提交给集团转换后的VR地址！');
                        }else{
                          return Promise.resolve();
                        }
                      }
                    }
                    // { pattern:/[mideazy.com]|[https://webcase.51hitech.com]/,  message:'请使用提交给集团转换后的VR地址！'}
                  ],
                })(<Input
                    placeholder={actionType == 'check'?'':'请输入VR看房URL'}
                    disabled={actionType == 'check'}
                    onChange={(e) => { inputChange(e.target.value, 'vr') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={12}>
            <FlagBtn node={ <FormItem {...videoUrlLayout}
                        label="是否支持vr带看： ">
                {getFieldDecorator('vrBeltStatus', {
                  initialValue: estateInfo.vrBeltStatus ? estateInfo.vrBeltStatus.toString() : '0',
                  rules: [
                    { required: false, whitespace: true, message: '请选择vr带看状态' },
                  ],
                })((<Select placeholder="请选择" onChange={(val) => inputChange(val, 'vrBeltStatus')} disabled={actionType == 'check' || !estateInfo.vr}>
                  <Select.Option value="0">否</Select.Option>
                  <Select.Option value="1">是</Select.Option>
                </Select>))}
              </FormItem>}  btnId={'10105'}>
             
              </FlagBtn>
            </Col>
          </Row>
          {/* <Row style={{ "borderBottom": 'none' }}>
            {formvideoItems}
          </Row> */}
          <Row>
            <Col className="col" span={24}>
              {actionType=='check'?<FormItem {...imageLayout} label="视频url">
                {estateInfo.video&&estateInfo.video.map((item,index)=>{
                    return (
                      <a style={{lineHeight:1.5}} target="_blank" rel="noopener noreferrer" className="ant-upload-list-item-name" href={item.url}>{item.url}</a>
                    )
                  })}
              </FormItem >:<FormItem {...imageLayout} label="视频URL"
                        >
                  <Uploader 
                  uploadedUrls={estateInfo.video}
                              removeFileCbf={(index) => { removeImgUrl(index,'video') }}
                              uploadSuccessCbf={(imgUrl,fileObj) => { updateImageModel2(imgUrl, fileObj) }}
                              showType='5'
                              disabled={actionType == 'check'}
                              accept={'.mp4'}
                              uploadTip='支持*.mp4格式文件。'
                              fileType='video'
                              fileMaxSize='50'
                              maxFiles='10'/>
              </FormItem>}
            
              
              

              {/* <FormItem {...formItemLayout}>
              {actionType !== 'check'&&<Button type="dashed" onClick={() => add("video")} style={{ width: '60%', marginLeft: "27%" }}>
                <Icon type="plus" />添加视频url
              </Button>}
              </FormItem> */}
            </Col>
            {estateInfo.vrBeltStatus == '1'&&
              <Col className="col" span={24}>
                  {actionType=='check'?<FormItem {...imageLayout} label="音频URL">
                {estateInfo.voice&&estateInfo.voice.map((item,index)=>{
                    return (
                      <a style={{lineHeight:1.5}} target="_blank" rel="noopener noreferrer" className="ant-upload-list-item-name" href={item.url}>{item.url}</a>
                    )
                  })}
              </FormItem >:<FormItem {...imageLayout} label="音频URL">
                    <Uploader 
                      uploadedUrls={estateInfo.voice}
                      removeFileCbf={(index) => { removeImgUrl(index,'voice') }}
                      uploadSuccessCbf={(imgUrl,fileObj) => { updateVoiceUrl(imgUrl, fileObj) }}
                      showType='5'
                      disabled={actionType == 'check'}
                      accept={'.mp3'}
                      uploadTip='支持*.mp3格式文件。'
                      fileType='voice'
                      fileMaxSize='50'
                      maxFiles='1'/>
                  </FormItem>
                    
                  }
                
               
              </Col>
            }
          </Row>

          <Row>
            <Col className="col" span={12}>
              <FormItem {...lastLayout}
                label="上下架">
                {getFieldDecorator('shelfStatus', {
                  initialValue: estateInfo.shelfStatus ? estateInfo.shelfStatus+'':"",
                  rules: [
                    { required: true, whitespace: true, message: '请选择上下架' },
                  ],
                })(<Select placeholder="请选择" onChange={(e) => inputChange(e, 'shelfStatus')} disabled={actionType == 'check'}>
                  <Option value="0">未上架</Option>
                  <Option value="1">上架</Option>
                  <Option value="2">下架</Option>
                </Select>)}
              </FormItem>
            </Col>
            
          </Row>
          <Row>
            <Col className="col" span={24}>
              <FormItem {...regionLayout}
                label="楼盘分期">
                {getFieldDecorator('region', {
                  rules: [
                    { required: false, whitespace: true, message: '请选择楼盘分期' },
                  ],
                })(
                  <Row>
                    {actionType !== 'check'&&<Col span={2}><a onClick={(e) => { updateTagModel(true) }}>编辑</a></Col>}
                    <Col span={22}>{getTaglist}</Col>
                  </Row>
                )}
              </FormItem>
            </Col>
          </Row>
        </div>
      </CollapsiblePanels>
      <CollapsiblePanels title="楼盘亮点" hideUpDownBtn={true} >
        <Row>
          <Col className="col" span={12}>
            <FormItem {...lightLayout} label="亮点概述">
              {getFieldDecorator('brighSpotDescribe', {
                initialValue: estateInfo.brighSpotDescribe,
                rules: [{
                  required: true,
                  message: "请输入亮点概述",
                },{
                  max: 100,
                  message: "最多输入100个字符",
                }],
              })(<TextArea disabled={actionType == 'check'} rows={4} placeholder={actionType == 'check'?'':"城芯繁华地段，5M智慧健康社区\n九里河风光带，一线湖岸景观\n湖景洋房，轻奢生活，轻松拥有\n【排版可自行发挥】"} onChange={(e) => { inputChange(e.target.value, 'brighSpotDescribe') }} />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="地铁交通  亮点一">
              {getFieldDecorator('traffic', {
                initialValue: estateInfo.traffic,
                rules: [
                  { required: true, whitespace: true,  message: '请输入地铁交通  亮点一' },
                  { max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：100米地铁珠江新城站'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'traffic') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">
              {getFieldDecorator('trafficExtend', {
                initialValue: estateInfo.trafficExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'trafficExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="医疗配套  亮点一">
              {getFieldDecorator('medical', {
                initialValue: estateInfo.medical,
                rules: [
                  { required: true, whitespace: true,  message: '请输入医疗配套  亮点一' },
                  { max: 14, message: '最多14个字符' },

                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：三甲人民医院'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'medical') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">
              {getFieldDecorator('medicalExtend', {
                initialValue: estateInfo.medicalExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'medicalExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="购物消费  亮点一">
              {getFieldDecorator('consumption', {
                initialValue: estateInfo.consumption,
                rules: [
                  { required: true, whitespace: true, message: '请输入购物消费  亮点一' },
                  { max: 14, message: '最多14个字符' },

                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：万达广场、东汇城双广场'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'consumption') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">
              {getFieldDecorator('consumptionExtend', {
                initialValue: estateInfo.consumptionExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                  
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'consumptionExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="文化教育   亮点一">
              {getFieldDecorator('education', {
                initialValue: estateInfo.education,
                rules: [
                  { required: true, whitespace: true, message: '请输入文化教育   亮点一' },
                  { max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：实验中学'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'education') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">
              {getFieldDecorator('educationExtend', {
                initialValue: estateInfo.educationExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'educationExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="周边生活   亮点一">
              {getFieldDecorator('life', {
                initialValue: estateInfo.life,
                rules: [
                  { required: false, whitespace: true,  message: '请输入周边生活   亮点一' },
                  { max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：篮球场、网球场'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'life') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">
              {getFieldDecorator('lifeExtend', {
                initialValue: estateInfo.lifeExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                  
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'lifeExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="地理位置  亮点一">
              {getFieldDecorator('position', {
                initialValue: estateInfo.position,
                rules: [
                  { required: false, whitespace: true, message: '请输入地理位置  亮点一' },
                  { max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：距离黄鹤楼1000米'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'position') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">

              {getFieldDecorator('positionExtend', {
                initialValue: estateInfo.positionExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'positionExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="设计风格  亮点一">
              {getFieldDecorator('style', {
                initialValue: estateInfo.style,
                rules: [
                  { required: false, whitespace: true,  message: '请输入设计风格  亮点一' },
                  { max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：现代化风格'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'style') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">

              {getFieldDecorator('styleExtend', {
                initialValue: estateInfo.styleExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'styleExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="附近风景  亮点一">
              {getFieldDecorator('scenery', {
                initialValue: estateInfo.scenery,
                rules: [
                  { required: false, whitespace: true, message: '请输入附近风景  亮点一' },
                  { max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：白云山、白云湖'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'scenery') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">
              {getFieldDecorator('sceneryExtend', {
                initialValue: estateInfo.sceneryExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'sceneryExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col className="col" span={12}>
            <FormItem {...littlelightLayout}
              label="精致产品  亮点一">
              {getFieldDecorator('product', {
                initialValue: estateInfo.product,
                rules: [
                  { required: false, whitespace: true,  message: '请输入精致产品  亮点一' },
                  { max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'例：纯复式'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'product') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={12}>
            <FormItem {...videoUrlLayout}
              label="亮点二">
              {getFieldDecorator('productExtend', {
                initialValue: estateInfo.productExtend,
                rules: [
                  { required: false, whitespace: true, max: 14, message: '最多14个字符' },
                ],
              })(<Input
                placeholder={actionType == 'check'?'':'最多14个字符'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'productExtend') }}
              />)}
            </FormItem>
          </Col>
        </Row>
      </CollapsiblePanels>
      <CollapsiblePanels title="上传图片" hideUpDownBtn={true} >
      <Row>
              <div style={{    width: '8.33333333%',marginBottom:'20px',textAlign:'right',color:'#666',position:'relative'}}>
                楼盘全屏图
                  <Tooltip title={
                      <div>
                        图片显示位置:进入楼盘详情自动打开封面图
                      </div>
                  }><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginLeft:'10px',position:'absolute',left:'100%' }} /></Tooltip>
              </div>

              <FormItem {...imageLayout}
              required={estateInfo.shelfStatus=="1"}
                        style={{ marginLeft: "8.33333333%" }}>
                  <Uploader uploadedUrls ={estateInfo.appPhoto}
                            removeFileCbf={(index)=>{removeImgUrl(index,"appPhoto")}}
                            uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"appPhoto")} }
                            showType={actionType == 'check'?'4':'6'}
                            fileType='image'
                            fileMaxSize='0.5'
                            minCropBoxWidth={1500}
                            minCropBoxHeight={3000}
                            maxFiles='1' />
              </FormItem>
              <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1500px*3000px，且文件大小在500k以下，支持jpg，png格式。'}
              </span>
              <br></br>
              <span style={{ color: "#999", marginLeft: "4%" }}>
              {'图片显示位置:进入楼盘详情前会先显示楼盘全屏图'}
              </span>
              
              </Col>
          </Row>
          <Divider />
          <Row>
              <div style={{    width: '8.33333333%',marginBottom:'20px',textAlign:'right',color:'#666',position:'relative'}}>
                <span style={{color:'red',marginRight: "4px",fontFamily: "SimSun",lineHeight: "1px",fontSize: "14px"}}>{estateInfo.shelfStatus=="1"?'*':""}</span>
                缩略图配置
                  <Tooltip title={
                      <div>
                        缩略图：缩略图展示在新房图、找房列表图、预约看房图、推荐美房图、我的-浏览记录、我的-关注等
                      </div>
                  }><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginLeft:'10px',position:'absolute',left:'100%' }} /></Tooltip>
              </div>

              <FormItem {...imageLayout}
              required={estateInfo.shelfStatus=="1"}
                        style={{ marginLeft: "8.33333333%" }}>
                  <Uploader uploadedUrls ={estateInfo.smallimg}
                            removeFileCbf={(index)=>{removeImgUrl(index,"smallimg")}}
                            uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"smallimg")} }
                            showType={actionType == 'check'?'4':'6'}
                            fileType='image'
                            fileMaxSize='0.5'
                            minCropBoxWidth={1372}
                            minCropBoxHeight={560}
                            maxFiles='1' />
              </FormItem>
              <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1372px*560px，且文件大小在500kb以下，支持jpg，png格式。'}
              </span>
              </Col>
          </Row>
          <Divider />
        <Row>
          <FormItem {...imageLayout}
            label="规划图">
            <Uploader uploadedUrls ={estateInfo.plan}
                      removeFileCbf={(index)=>{removeImgUrl(index,"plan")}}
                      uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"plan")} }
                      showType={actionType == 'check'?'4':'6'}
                      fileType='image'
                      fileMaxSize='0.5'
                      minCropBoxWidth={1500}
                      minCropBoxHeight={1120}
                      maxFiles='1000' />
          </FormItem>
          <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1500px*1120px，且文件大小在500kb以下，支持jpg，png格式。'}
              </span>
          </Col>
        </Row>
        <Divider />
        <Row>
          <FormItem {...imageLayout}
            required={estateInfo.shelfStatus=="1"}
            label="效果图">
            <Uploader uploadedUrls ={estateInfo.effect}
                      removeFileCbf={(index)=>{removeImgUrl(index,"effect")}}
                      uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"effect")} }
                      showType={actionType == 'check'?'4':'6'}
                      fileType='image'
                      fileMaxSize='0.5'
                      minCropBoxWidth={1500}
                      minCropBoxHeight={1120}
                      maxFiles='1000' />
          </FormItem>
          <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1500px*1120px，且文件大小在500kb以下，支持jpg，png格式。'}
              </span>
          </Col>
        </Row>
        <Divider />
        <Row>
          <FormItem {...imageLayout}
            label="实景图">
           <Uploader uploadedUrls ={estateInfo.realScene}
                      removeFileCbf={(index)=>{removeImgUrl(index,"realScene")}}
                      uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"realScene")} }
                      showType={actionType == 'check'?'4':'6'}
                      fileType='image'
                      fileMaxSize='0.5'
                      minCropBoxWidth={1500}
                      minCropBoxHeight={1120}
                      maxFiles='1000' />
          </FormItem>
          <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1500px*1120px，且文件大小在500kb以下，支持jpg，png格式。'}
              </span>
          </Col>
        </Row>
        <Divider />
        <Row>
          <FormItem {...imageLayout}
            label="周边配套">
            <Uploader uploadedUrls ={estateInfo.periphery}
                      removeFileCbf={(index)=>{removeImgUrl(index,"periphery")}}
                      uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"periphery")} }
                      showType={actionType == 'check'?'4':'6'}
                      fileType='image'
                      fileMaxSize='0.5'
                      minCropBoxWidth={1500}
                      minCropBoxHeight={1120}
                      maxFiles='1000' />
          </FormItem>
          <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1500px*1120px，且文件大小在500kb以下，支持jpg，png格式。'}
              </span>
          </Col>
        </Row>
        <Divider />
        <Row>
          <FormItem {...imageLayout}
            label="专属海报">
             <Uploader uploadedUrls ={estateInfo.poster}
                      removeFileCbf={(index)=>{removeImgUrl(index,"poster")}}
                      uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"poster")} }
                      showType={actionType == 'check'?'4':'6'}
                      fileType='image'
                      fileMaxSize='0.5'
                      minCropBoxWidth={1500}
                      minCropBoxHeight={2668}
                      maxFiles='1' />
          </FormItem>
          <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1500px*2668px，且文件大小在500kb以下，支持jpg，png格式。'}
              </span>
          </Col>
        </Row>
        <Divider />
        <Row>
          <FormItem {...imageLayout}
            label="楼栋鸟瞰图">
            <Uploader uploadedUrls ={estateInfo.building}
                      removeFileCbf={(index)=>{removeImgUrl(index,"building")}}
                      uploadSuccessCbf={ (imgUrl) => {updateImageModel(imgUrl,"building")} }
                      showType={actionType == 'check'?'4':'6'}
                      fileType='image'
                      fileMaxSize='0.5'
                      minCropBoxWidth={1500}
                      minCropBoxHeight={1500}
                      maxFiles='1' />
          </FormItem>
          <Col span={12}>
            <span style={{ color: "#999", marginLeft: "4%" }}>
              {actionType == 'check'?"":'图片分辨率需为1500px*1500px，且文件大小在500kb以下，支持jpg，png格式。'}
              </span>
          </Col>
        </Row>
      </CollapsiblePanels>
      {/* <CollapsiblePanels title="美的置业云-全民营销佣金配置" hideUpDownBtn={true} >
        <Row>
          
          <Col className="col" span={9}>
            <FormItem {...formItemLayout}
              label="美的置业云首页佣金标签">
              {getFieldDecorator('commissionLabel', {
                initialValue: estateInfo.commissionLabel,
                rules: [
                  { required: false, whitespace: true, message: '请选择美的置业云首页佣金标签' },
                  { max:8, message: '长度不能超过8个字符' },
                ],
              })(<Input
                rows={4}
                placeholder={actionType == 'check'?"":'示例：佣金1%'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'commissionLabel') }}
              />)}
            </FormItem>
          </Col>
          <Col span={4}>
                  <Tooltip title="标签显示在美的置业云首页-智美新房列表、找房列表"><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginLeft:'8px',marginTop:'8px' }} /></Tooltip>
          </Col>

          <Col className="col" span={11}>
            <FormItem {...formItemLayout}
              label="项目主页佣金规则介绍">
              {getFieldDecorator('commission', {
                initialValue: estateInfo.commission,
                rules: [
                  { required: false, whitespace: true, message: '请选择项目主页佣金规则介绍' },
                ],
              })(
                <Input
                rows={12}
                placeholder={actionType == 'check'?"":'示例：推介佣金：住宅8%，车位5%，商铺2%'}
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'commission') }}
              />
              )}
            </FormItem>
          </Col>
        </Row>
        
      </CollapsiblePanels> */}
      {/* <CollapsiblePanels title="智美分销-合作中介信息配置" hideUpDownBtn={true} >
       <Row>
        <Col className="col" span={10}>
        <FormItem {...littlelightLayout7}
          label="合作期佣金比例">
          {getFieldDecorator('workCommissionRate', {
            initialValue: estateInfo.workCommissionRate?estateInfo.workCommissionRate  + "":null,
            rules: [
              { required: false, whitespace: true, message: '请输入合作期佣金比例' },
              { pattern:/\d/,message: '请输入数字'}
            ],
          })(
            <Row>
              <Col span={18}>
                <Input
                rows={4}
                placeholder={actionType == 'check'?"":'请输入合作期佣金比例'}
                addonAfter="%"
                disabled={actionType == 'check'}
                onChange={(e) => { inputChange(e.target.value, 'workCommissionRate') }}
              />
              </Col>
              <Col span={4}>
              </Col>
            </Row>)}
        </FormItem>
        </Col>
        <Col className="col" span={10}>
        <Row>
            <Col span={20}>
              <FormItem {...formItemLastLayout}
                label="缓冲期(保护期)"
                >
                {getFieldDecorator('bufferDays', {
                  initialValue: estateInfo.bufferDays||estateInfo.bufferDays==0?estateInfo.bufferDays + "" : null,
                  rules: [
                    { pattern:/^[0-9]\d*$/,message: '请输入数字'}
                  ],
                })(
                
                      <Input
                        rows={4}
                        placeholder={actionType == 'check'?"":'请输入缓冲期'}
                        addonAfter="天"
                        disabled={actionType == 'check'}
                        onChange={(e) => { inputChange(e.target.value, 'bufferDays') }}
                      />
                  
                )}
                
              </FormItem>
            </Col>
              <Col span={4}>
                <Tooltip title="渠道和项目的合作有效期到期后，在合作期内报备到访的客户，在缓冲期，有成交，则佣金可结算给渠道。"><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginLeft:'8px',marginTop:'8px' }} /></Tooltip>
              </Col>
            </Row>
        </Col>
        </Row>
        <Row>
        <Col className="col" span={10}>
        <Row>
            <Col span={18}>
              <FormItem {...formItemshortLayout}
                label="报备到访最短有效时间"
                >
                {getFieldDecorator('visitMinHours', {
                  initialValue: estateInfo.visitMinHours||estateInfo.visitMinHours==0?estateInfo.visitMinHours + "" : null,
                  rules: [
                    { pattern: /^\d{0,8}\.{0,1}(\d{1,2})?$/,message: '请输入数字或两位小数'}
                  ],
                })(
                      <Input
                        rows={4}
                        placeholder={actionType == 'check'?"":'请输入报备到访最短有效时间'}
                        addonAfter="小时"
                        disabled={actionType == 'check'}
                        onChange={(e) => { inputChange(e.target.value, 'visitMinHours') }}
                      />
                )}
              </FormItem>
          </Col>
          <Col span={2}>
            <Tooltip title="作为扫码判客的提示，必须要在报备时间+到访最短有效时间  后 且在合同有效期内 到访才有效。支持小数点后2位。"><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginLeft:'8px',marginTop:'8px'}} /></Tooltip>
          </Col>
          <Col span={10} push={7}><span style={{ fontSize: '14px', color: '#08c'}} >等于{min}分钟</span></Col>
        </Row>
        
        </Col>
        <Col className="col" span={10}>
        <Row>
            <Col span={18}>
              <FormItem {...formItemshortLayout}
                label="报备到访最长有效时间"
                >
                {getFieldDecorator('longestTime', {
                  initialValue: estateInfo.longestTime||estateInfo.longestTime==0?estateInfo.longestTime + "" : null,
                  rules: [
                    { pattern: /^\d{0,8}\.{0,1}(\d{1,2})?$/,message: '请输入数字或两位小数'},
                    {
                      validator: (rule, values, callback) => {
                        if (values && values.length > 0) {
                          if(parseFloat(values)>parseFloat(estateInfo.visitMinHours)){
                            callback();                            
                            }else{
                              callback('最长有效时间必须大于最短有效时间！')
                            }
                        } else {
                          callback();
                        }
                      }
                    }
                  ],
                })(
                      <Input
                        rows={4}
                        placeholder={actionType == 'check'?"":'请输入报备到访最长有效时间'}
                        addonAfter="小时"
                        disabled={actionType == 'check'}
                        onChange={(e) => { inputChange(e.target.value, 'longestTime') }}
                      />
                )}
              </FormItem>
          </Col>
          <Col span={2}>
            <Tooltip title="客户必须在报备时间+到访最长有效时间内到访才有效，逾期未到访需重新报备客户"><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginLeft:'8px',marginTop:'8px'}} /></Tooltip>
          </Col>
          <Col span={10} push={7}><span style={{ fontSize: '14px', color: '#08c'}} >等于{min2||0}分钟</span></Col>
        </Row>
        
        </Col>
        </Row>
        <Row>
          <Col className="col" span={8}>
                <Col span={20}>
                  <FormItem {...formItemLastLayout}
                    label="成交失效时长（天）"
                    >
                    {getFieldDecorator('transactionInvalidDays', {
                      initialValue: estateInfo.transactionInvalidDays||estateInfo.transactionInvalidDays==0? estateInfo.transactionInvalidDays  + "" :null,
                      rules: [
                      
                        { pattern:/^[0-9]\d*$/,message: '请输入整数'}
                      ],
                    })(
                      
                          <Input
                          rows={4}
                          placeholder={actionType == 'check'?"":'请输入成交失效时长'}
                          addonAfter="天"
                          disabled={actionType == 'check'}
                          onChange={(e) => { inputChange(e.target.value, 'transactionInvalidDays') }}
                        />
                        
                      )}
                      
                  </FormItem>
                  </Col>
                <Col span={4}>
                  <Tooltip title="客户到访后，在合同有效期内，并在该项设置的时间内签约认购有效，佣金可结算给渠道。设置为0，则按合同期内有效。"><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginLeft:'8px',marginTop:'8px' }} /></Tooltip>
                </Col>
          </Col>
        </Row>

     </CollapsiblePanels> */}
     { actionType&&actionType=='check'?
     <CollapsiblePanels title="创建信息" hideUpDownBtn={true} style={{ marginBottom: 70 }}>
      <Row>
        <Col span={12}><span>创建人：{estateInfo.createPerson}</span></Col>
        <Col span={12}><span>创建时间：{estateInfo.createTime}</span></Col>
      </Row>
     </CollapsiblePanels>:null}
     
      <PopUpSelect
        tableColumn={sellerTableColumn}
        selectedColumn={sellerSelectedColumn}
        selectedTableScroll={{ x: 420 }}
        queryList={cloneDeep(modelObj.sellerQueryList)}
        visible={showModel}
        // handleParam={params => handleParam(params)}
        closeCbk={e => updateModal(false)}
        onQueryChange={queryList => {
          changeState({sellerQueryList:queryList})
          // queryList&&queryList.map((item,index)=>{
          //   // debugger
          //   //   if((item.key=='appId')&&(item.value!=cloneDeep(modelObj.sellerQueryList)[index].value)){
          //   //     changeState({sellerQueryList:queryList})
          //   //   }
          //   changeState({sellerQueryList:queryList})
          // })
        }}
        confirmCbk={confirmCbk}
        isSave={true}
        isSingle={true}
        onItem={sellerList}
        status='1'
        requestUrl='admin/productDetailItem/queryProductDetailItem'
        title='选择工程名称'
        respListKey='rows'
        idKey = 'projectCode'
      />
      
      <Track
        visible={Mapmodel}
        queryList={mapQueryList}
        btnDiv={true}
        latAndLon={estateInfo.latAndLon}
        cancal={e => updateMapmodel(false)}
        cbk={(v, b) => cbk(v, b)}
        options={areaList}
      />
      <Track
        visible={saleMapmodel}
        queryList={mapQueryList}
        btnDiv={true}
        latAndLon={estateInfo.saleLatAndLon}
        cancal={e => updateSaleMapmodel(false)}
        cbk={(v, b) => saleCbk(v, b)}
        options={areaList}
      />
       <Modal
        title={'楼盘分期编辑'}
        visible={tagModel}
        onOk={()=>{
          form.validateFields(['estateRegion'],(err, values) => {
            console.log(err)
            if(!err){
              updateTagModel(false)
            }
          })
        }}
        onCancel={()=>{
          form.validateFields(['estateRegion'],(err, values) => {
            console.log(err)
            if(!err){
              updateTagModel(false)
            }
          })
        }}
      >
       
        <Row>
          <Col className="col" span={22}>
            <FormItem {...formItemLayout}
              label="每行一个分期"
            >
              {getFieldDecorator('estateRegion', {
                initialValue: estateInfo.estateRegion&&estateInfo.estateRegion.join("\n"),
                rules: [
                  { required: false, whitespace: true, message: '请输入标签' },
                  {validator: function (rule, value, callback){
                      if(value&&value.length>0){
                        let str=value.split(/[\r\n|\n]/)
                        let errorMsg=''
                        str.map((item)=>{
                          if(item.trim().length>6){
                            errorMsg='每行一个标签名称，可多行。每行最多输入6个字'
                          }
                        })
                        if(errorMsg){
                          callback(errorMsg)
                        }else{
                          callback()
                        }
                      }else{
                        callback()
                      }
                    }}
                ],
              })( <TextArea
                style={{ height: '200px' }}
                rows={4}
                placeholder={actionType == 'check'?"":'示例:\n一期\n二期'}
                onChange={(e) => { inputChange(e.target.value, 'estateRegion') }}
              /> )}
            </FormItem>
          </Col>
        </Row>
      </Modal>
    </div>
  )
}

// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(baseinfoDetailView))
